package cn.gson.crm.controller;

import cn.gson.crm.model.pojos.*;
import cn.gson.crm.model.service.WarehousingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpSession;
import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("/WarehousingController")
public class WarehousingController {
    @Autowired
    WarehousingService warehousingService;
    @RequestMapping("/ContractMethod7")
    @ResponseBody
    public void piliansave(@RequestBody Volei vo){
        warehousingService.piliansave(vo.getPurchase());
    }
    @RequestMapping("/ContractMethod8")
    @ResponseBody
    public void piliansaveweixu(@RequestBody Volei vo){
        warehousingService.piliansaveweixu(vo.getRepairOrder());
    }
    @RequestMapping("/ContractMethod")
    @ResponseBody
    public void save(@RequestBody Warehousing warehousing){
        warehousingService.save(warehousing);
    }
    @RequestMapping("/ContractMethod2")
    @ResponseBody
    //查询当前登录人入库记录
    public Map<String,Object> selectwar(HttpSession session, Integer yid, Integer page, Integer size){
        return warehousingService.selectwar(session,yid,page,size);
    };
    @RequestMapping("/ContractMethod3")
    @ResponseBody
    //时间查询
    public Map<String,Object> selecttime(HttpSession session,Integer yid,String statr, String endtime, Integer page, Integer size){
        return warehousingService.selecttime(session,yid,statr,endtime,page,size);
    };
    @RequestMapping("/ContractMethod4")
    @ResponseBody
    //条件查询
    public Map<String,Object> selectwhere(HttpSession session,Integer yid, String where,Integer page,Integer size){
        return warehousingService.selectwhere(session,yid,where,page,size);
    };
    @RequestMapping("/ContractMethod5")
    @ResponseBody
    //修改入库状态
    public void updateruku(Integer wid){
        warehousingService.updateruku(wid);
    };
    @RequestMapping("/ContractMethod6")
    @ResponseBody
    public List<WaouDetails> selectwaDel(Integer wid){
        return warehousingService.selectwaDel(wid);
    };


}
